<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateSocialAccountTable extends Migration
{
    /**
     * 第三方登录关联
     */
    public function up(): void
    {
        Schema::create('social_account', function (Blueprint $table) {
            $table->integer('user_id');
            $table->string('provider', 8)->default('weixin')->comment('第三方平台');
            $table->string('provider_user_id', 50)->default('')->comment('第三方平台账号ID');
            $table->unique(['user_id', 'provider'], 'provider');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('social_account');
    }
}
